library(mixtools)
head(faithful)
waiting = faithful$waiting
eruptions =faithful$eruptions
hist(eruptions)
log.eruptions =log(faithful$eruptions)
hist(log.eruptions)
normalmixEM
help("normalmixEM")
mixmdl = normalmixEM(log.eruptions, k=2)
str(mixmdl)
mixmdl$lambda
sum(mixmdl$lambda)
mixmdl$mu
mixmdl$sigma
plot(mixmdl,which=2)
plot(waiting,eruptions)
plot(log.eruptions,waiting)
plot(waiting,log.eruptions)
mod1<-lm(eruptions~waiting)
summary(mod1)
plot(waiting,eruptions)
abline(mod1, col='red', lwd=3)
library(mixreg)
mixturereg<-mixreg(x=waiting, y=eruptions, ncomp = 2, itmax = Inf,seed=140)
mixturereg$converged
mixturereg$theta
plot(mixturereg)
data<-aphids
hist(data$plntsInf)
plot(data$plntsInf,data$aphRel)
fit1   <- mixreg(aphRel,plntsInf,ncomp=2,seed=140,data=aphids)
help(mixreg)
data<-aphids
hist(data$plntsInf)
plot(data$plntsInf,data$aphRel)
fit1   <- mixreg(x=aphRel,y=plntsInf,ncomp=2,seed=140,data=aphids)
plot(fit1)
fit1   <- mixreg(x=aphRel,y=plntsInf,ncomp=3,seed=140,data=aphids)
plot(fit1)
